matplotlib time series plot
Official Documents
code:python
import matplotlib.dates as mdates
years = mdates.YearLocator(2) # every 2year
yearsFmt = mdates.DateFormatter('%Y')
ax.xaxis.set_major_locator(years)
ax.xaxis.set_major_formatter(yearsFmt)
Offifial examples
api example code: date_demo.py
pylab_examples example code: centered_ticklabels.py
Custom tick formatter for time series — Matplotlib 2.1.2 documentation
Examples
Customize Matplotlibe Dates Ticks on the x-axis in Python | Earth Data Science - Earth Lab
python - Controlling bars width in matplotlib with per-month data - Stack Overflow
matplotlibを使って時系列グラフを書いてみる - Qiita
code:python
import matplotlib.dates as mdates
hours=mdates.HourLocater(np.arange(0,24,2))
days=mdates.DayLocater(interval=1)
h_fmt=mdates.Dateformatter('%m/%d')
d_fmt=mdates.Dateformatter('')
ax.xaxis.set_minor_locator(hours)
ax.xaxis.set_major_locator(days)
ax.xaxis.set_minor_formatter(h_fmt)
ax.xaxis.set_major_formatter(d_fmt)
Tips
change style
code: python
plt.style.set("fivethirtyeigh")
Error "signed integer is greater than maximum"
python - Plot numpy datetime64 with matplotlib - Stack Overflow
code:python
from datetime import datetime
a=np.datetime64('2002-06-28').astype(datetime)
plot_date(a,2)
Paid Tutorial
Visualizing Time Series Data in Python | DataCamp
See also